package com.nbsaas.boot.store.rest.convert;

import com.nbsaas.boot.store.data.entity.StoreCheckInRecord;
import com.nbsaas.boot.store.api.domain.simple.StoreCheckInRecordSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* 场馆入场记录-列表对象转换器
*/

public class StoreCheckInRecordSimpleConvert implements Converter<StoreCheckInRecordSimple, StoreCheckInRecord> {




@Override
public StoreCheckInRecordSimple convert(StoreCheckInRecord source) {
    StoreCheckInRecordSimple result = new StoreCheckInRecordSimple();

                if(source.getCustomer()!=null){
                    result.setCustomerPhone(source.getCustomer().getPhone());
                }

                try {
                    if(source.getStore()!=null){
                        result.setStoreName(source.getStore().getName());
                    }
                } catch (Exception ignored) { }


               try {
                   if(source.getStore()!=null){
                       result.setStore(source.getStore().getId());
                   }
                } catch (Exception ignored) { }

                result.setId(source.getId());
                result.setAddDate(source.getAddDate());

                try {
                    if(source.getCustomer()!=null){
                        result.setCustomerName(source.getCustomer().getName());
                    }
                } catch (Exception ignored) { }


               try {
                   if(source.getCustomer()!=null){
                       result.setCustomer(source.getCustomer().getId());
                   }
                } catch (Exception ignored) { }

                result.setLastDate(source.getLastDate());


    return result;
}

}